/*
Date:20211010 21:55PM
key:挑前两个里面小的去+当前的
*/
class Solution {
public:
    int minCostClimbingStairs(vector<int>& cost) {
    int*Dp=new int[cost.size()];
    Dp[0]=cost[0];
    Dp[1]=cost[1];
    for(int i=2;i<cost.size();i++)
    {
        Dp[i]=min(Dp[i-1],Dp[i-2])+cost[i];
    }
    return min(Dp[cost.size()-1],Dp[cost.size()-2]);
    }
};